<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.10"/>
<title>Introduction_to_Algorithms: IntroductionToAlgorithm::SetAlgorithm::DisjointSetNode&lt; KType &gt; Struct Template Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">Introduction_to_Algorithms
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.10 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="classes.html"><span>Class&#160;Index</span></a></li>
      <li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('struct_introduction_to_algorithm_1_1_set_algorithm_1_1_disjoint_set_node.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#pub-types">Public Types</a> &#124;
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pub-static-methods">Static Public Member Functions</a> &#124;
<a href="#pub-attribs">Public Attributes</a> &#124;
<a href="struct_introduction_to_algorithm_1_1_set_algorithm_1_1_disjoint_set_node-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">IntroductionToAlgorithm::SetAlgorithm::DisjointSetNode&lt; KType &gt; Struct Template Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>DisjointSetNode：不相交集合森林的节点，算法导论第21章21.3节  
 <a href="struct_introduction_to_algorithm_1_1_set_algorithm_1_1_disjoint_set_node.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="disjointset_8h_source.html">disjointset.h</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-types"></a>
Public Types</h2></td></tr>
<tr class="memitem:a8f801679de129d80a99ad683430c534a"><td class="memItemLeft" align="right" valign="top">typedef KType&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_introduction_to_algorithm_1_1_set_algorithm_1_1_disjoint_set_node.html#a8f801679de129d80a99ad683430c534a">KeyType</a></td></tr>
<tr class="separator:a8f801679de129d80a99ad683430c534a"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a579c4ac62902b32c0bd04ccea02536ea"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_introduction_to_algorithm_1_1_set_algorithm_1_1_disjoint_set_node.html#a579c4ac62902b32c0bd04ccea02536ea">DisjointSetNode</a> (std::shared_ptr&lt; <a class="el" href="struct_introduction_to_algorithm_1_1_set_algorithm_1_1_disjoint_set_node.html#a8f801679de129d80a99ad683430c534a">KeyType</a> &gt;v)</td></tr>
<tr class="memdesc:a579c4ac62902b32c0bd04ccea02536ea"><td class="mdescLeft">&#160;</td><td class="mdescRight">DisjointSetNode的显式构造函数  <a href="#a579c4ac62902b32c0bd04ccea02536ea">More...</a><br /></td></tr>
<tr class="separator:a579c4ac62902b32c0bd04ccea02536ea"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-static-methods"></a>
Static Public Member Functions</h2></td></tr>
<tr class="memitem:a85fa0b8f80ba6529936ba2103c68194c"><td class="memItemLeft" align="right" valign="top">static std::shared_ptr&lt; <a class="el" href="struct_introduction_to_algorithm_1_1_set_algorithm_1_1_disjoint_set_node.html">DisjointSetNode</a> &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_introduction_to_algorithm_1_1_set_algorithm_1_1_disjoint_set_node.html#a85fa0b8f80ba6529936ba2103c68194c">find_set</a> (std::shared_ptr&lt; <a class="el" href="struct_introduction_to_algorithm_1_1_set_algorithm_1_1_disjoint_set_node.html">DisjointSetNode</a> &gt;node)</td></tr>
<tr class="memdesc:a85fa0b8f80ba6529936ba2103c68194c"><td class="mdescLeft">&#160;</td><td class="mdescRight">find_set：返回结点所在集合的代表结点  <a href="#a85fa0b8f80ba6529936ba2103c68194c">More...</a><br /></td></tr>
<tr class="separator:a85fa0b8f80ba6529936ba2103c68194c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7346337c6f47bf066844c7101058cd92"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_introduction_to_algorithm_1_1_set_algorithm_1_1_disjoint_set_node.html#a7346337c6f47bf066844c7101058cd92">make_set</a> (std::shared_ptr&lt; <a class="el" href="struct_introduction_to_algorithm_1_1_set_algorithm_1_1_disjoint_set_node.html">DisjointSetNode</a> &gt;node)</td></tr>
<tr class="memdesc:a7346337c6f47bf066844c7101058cd92"><td class="mdescLeft">&#160;</td><td class="mdescRight">make_set：创建集合  <a href="#a7346337c6f47bf066844c7101058cd92">More...</a><br /></td></tr>
<tr class="separator:a7346337c6f47bf066844c7101058cd92"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac5fff2fa07d82ed04529aa9159d37efc"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_introduction_to_algorithm_1_1_set_algorithm_1_1_disjoint_set_node.html#ac5fff2fa07d82ed04529aa9159d37efc">link_set</a> (std::shared_ptr&lt; <a class="el" href="struct_introduction_to_algorithm_1_1_set_algorithm_1_1_disjoint_set_node.html">DisjointSetNode</a> &gt;nodeX, std::shared_ptr&lt; <a class="el" href="struct_introduction_to_algorithm_1_1_set_algorithm_1_1_disjoint_set_node.html">DisjointSetNode</a> &gt;nodeY)</td></tr>
<tr class="memdesc:ac5fff2fa07d82ed04529aa9159d37efc"><td class="mdescLeft">&#160;</td><td class="mdescRight">link_set：链接集合  <a href="#ac5fff2fa07d82ed04529aa9159d37efc">More...</a><br /></td></tr>
<tr class="separator:ac5fff2fa07d82ed04529aa9159d37efc"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aeb6281c8d6ec20987015fb1d1421b309"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_introduction_to_algorithm_1_1_set_algorithm_1_1_disjoint_set_node.html#aeb6281c8d6ec20987015fb1d1421b309">union_set</a> (std::shared_ptr&lt; <a class="el" href="struct_introduction_to_algorithm_1_1_set_algorithm_1_1_disjoint_set_node.html">DisjointSetNode</a> &gt;nodeX, std::shared_ptr&lt; <a class="el" href="struct_introduction_to_algorithm_1_1_set_algorithm_1_1_disjoint_set_node.html">DisjointSetNode</a> &gt;nodeY)</td></tr>
<tr class="memdesc:aeb6281c8d6ec20987015fb1d1421b309"><td class="mdescLeft">&#160;</td><td class="mdescRight">union_set：合并集合  <a href="#aeb6281c8d6ec20987015fb1d1421b309">More...</a><br /></td></tr>
<tr class="separator:aeb6281c8d6ec20987015fb1d1421b309"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-attribs"></a>
Public Attributes</h2></td></tr>
<tr class="memitem:ae01535aa5e8ba05dceedd5c475d61c18"><td class="memItemLeft" align="right" valign="top">std::weak_ptr&lt; <a class="el" href="struct_introduction_to_algorithm_1_1_set_algorithm_1_1_disjoint_set_node.html#a8f801679de129d80a99ad683430c534a">KeyType</a> &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_introduction_to_algorithm_1_1_set_algorithm_1_1_disjoint_set_node.html#ae01535aa5e8ba05dceedd5c475d61c18">value</a></td></tr>
<tr class="separator:ae01535aa5e8ba05dceedd5c475d61c18"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1fd137f74ca1317bfb02d9e1640ce147"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_introduction_to_algorithm_1_1_set_algorithm_1_1_disjoint_set_node.html#a1fd137f74ca1317bfb02d9e1640ce147">rank</a></td></tr>
<tr class="separator:a1fd137f74ca1317bfb02d9e1640ce147"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad5cf3f4d739ecd0c1f6d3b3005e21993"><td class="memItemLeft" align="right" valign="top">std::shared_ptr&lt; <a class="el" href="struct_introduction_to_algorithm_1_1_set_algorithm_1_1_disjoint_set_node.html">DisjointSetNode</a> &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_introduction_to_algorithm_1_1_set_algorithm_1_1_disjoint_set_node.html#ad5cf3f4d739ecd0c1f6d3b3005e21993">parent</a></td></tr>
<tr class="separator:ad5cf3f4d739ecd0c1f6d3b3005e21993"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><h3>template&lt;typename KType&gt;<br />
struct IntroductionToAlgorithm::SetAlgorithm::DisjointSetNode&lt; KType &gt;</h3>

<p>DisjointSetNode：不相交集合森林的节点，算法导论第21章21.3节 </p>
<p>一个不相交集合数据结构维护了一个不相交动态集的集合{S1,S2,...Sk}。我们用一个代表来标识每个集合，它是这个集合的某个成员。 不相交集合支持三个操作：（x,y等都是集合中的对象)</p>
<ul>
<li>make_set(x):建立一个新的集合，它的唯一成员是x</li>
<li>unionx(x,y):将包含x和y的两个动态集合(表示为Sx和Sy)合并成一个新的集合。由于我们要求各个集合不相交，因此这里要消除原有的集合Sx和Sy。实际操作中， 我们把其中的一个集合的元素并入另一个集合中，来代替删除操作。</li>
<li>find_set(x):返回一个指针，该指针指向包含x的唯一集合的代表。</li>
</ul>
<p>在某些图的算法中，图和不相交集数据结构的表示需要相互引用。即一个表示顶点的对象会包含一个指向与之对应的不相交集合对象的指针；反之亦然</p>
<p>不相交集合森林：不相交集合森林是不相交集合的一种更快的实现。用有根数来表示集合，树中的每个结点都包含一个成员，每棵树代表一个集合。 在不相交集合森林中，每个成员仅仅指向它的父节点。每棵树的根就是集合的代表并且它的父节点就是自己。</p>
<p>这里采用了启发式策略改进运行时间，使用了两种启发式策略：</p><ul>
<li>按秩合并：每个结点x维持一个整数值属性rank,它代表了x的高度（从x到某一后代叶结点的最长简单路径上的结点数目）的一个上界。在按秩合并的union操作中， 我们让具有较小秩的根指向具有较大秩的根</li>
<li>路径压缩：在<code>find_set</code>操作中，使查找路径中的每个结点直接指向树根</li>
</ul>
<p>如果单独采用按秩合并或者路径压缩，它们每一个都能改善不相交集合森林上操作的运行时间；而一起使用这两种启发式策略时，这种改善更大。 当同时使用按秩合并和路径压缩时，最坏情况下的运行时间为O(m*alpha*n))，这里alpha(n)是一个增长非常慢的函数。在任何一个可以想得到的不相交集合数据结构的应用中， alpha(n)&lt;=4。其中n为结点个数，m为操作次数（运用了摊还分析） </p>

<p>Definition at line <a class="el" href="disjointset_8h_source.html#l00054">54</a> of file <a class="el" href="disjointset_8h_source.html">disjointset.h</a>.</p>
</div><h2 class="groupheader">Member Typedef Documentation</h2>
<a class="anchor" id="a8f801679de129d80a99ad683430c534a"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename KType &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">typedef KType <a class="el" href="struct_introduction_to_algorithm_1_1_set_algorithm_1_1_disjoint_set_node.html">IntroductionToAlgorithm::SetAlgorithm::DisjointSetNode</a>&lt; KType &gt;::<a class="el" href="struct_introduction_to_algorithm_1_1_set_algorithm_1_1_disjoint_set_node.html#a8f801679de129d80a99ad683430c534a">KeyType</a></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>结点保存的数据类型 </p>

<p>Definition at line <a class="el" href="disjointset_8h_source.html#l00056">56</a> of file <a class="el" href="disjointset_8h_source.html">disjointset.h</a>.</p>

</div>
</div>
<h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="a579c4ac62902b32c0bd04ccea02536ea"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename KType &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="struct_introduction_to_algorithm_1_1_set_algorithm_1_1_disjoint_set_node.html">IntroductionToAlgorithm::SetAlgorithm::DisjointSetNode</a>&lt; KType &gt;::<a class="el" href="struct_introduction_to_algorithm_1_1_set_algorithm_1_1_disjoint_set_node.html">DisjointSetNode</a> </td>
          <td>(</td>
          <td class="paramtype">std::shared_ptr&lt; <a class="el" href="struct_introduction_to_algorithm_1_1_set_algorithm_1_1_disjoint_set_node.html#a8f801679de129d80a99ad683430c534a">KeyType</a> &gt;&#160;</td>
          <td class="paramname"><em>v</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">explicit</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>DisjointSetNode的显式构造函数 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">v:结点保存的数据的指针</td><td>将v存入结点的value中 </td></tr>
  </table>
  </dd>
</dl>

<p>Definition at line <a class="el" href="disjointset_8h_source.html#l00065">65</a> of file <a class="el" href="disjointset_8h_source.html">disjointset.h</a>.</p>

</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="a85fa0b8f80ba6529936ba2103c68194c"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename KType &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static std::shared_ptr&lt;<a class="el" href="struct_introduction_to_algorithm_1_1_set_algorithm_1_1_disjoint_set_node.html">DisjointSetNode</a>&gt; <a class="el" href="struct_introduction_to_algorithm_1_1_set_algorithm_1_1_disjoint_set_node.html">IntroductionToAlgorithm::SetAlgorithm::DisjointSetNode</a>&lt; KType &gt;::find_set </td>
          <td>(</td>
          <td class="paramtype">std::shared_ptr&lt; <a class="el" href="struct_introduction_to_algorithm_1_1_set_algorithm_1_1_disjoint_set_node.html">DisjointSetNode</a>&lt; KType &gt; &gt;&#160;</td>
          <td class="paramname"><em>node</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>find_set：返回结点所在集合的代表结点 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">node:要查找的结点。它必须非空，否则抛出异常</td><td></td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>: 结点所在集合的代表结点的强指针</dd></dl>
<p>该操作简单沿着指向父节点的指针找到树的根。树的根的特征是：它的父节点就是它本身。 若结点不在不相交集合森林中（当结点的父节点指针为空时），则抛出异常。</p>
<p>find_set过程是一个 two_pass method，当它递归时，第一趟沿着查找路径向上直到找到树根； 当递归回溯时，第二趟沿着搜索树向下更新每个节点，使其父节点直接指向树根 </p>

<p>Definition at line <a class="el" href="disjointset_8h_source.html#l00084">84</a> of file <a class="el" href="disjointset_8h_source.html">disjointset.h</a>.</p>

</div>
</div>
<a class="anchor" id="ac5fff2fa07d82ed04529aa9159d37efc"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename KType &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static void <a class="el" href="struct_introduction_to_algorithm_1_1_set_algorithm_1_1_disjoint_set_node.html">IntroductionToAlgorithm::SetAlgorithm::DisjointSetNode</a>&lt; KType &gt;::link_set </td>
          <td>(</td>
          <td class="paramtype">std::shared_ptr&lt; <a class="el" href="struct_introduction_to_algorithm_1_1_set_algorithm_1_1_disjoint_set_node.html">DisjointSetNode</a>&lt; KType &gt; &gt;&#160;</td>
          <td class="paramname"><em>nodeX</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">std::shared_ptr&lt; <a class="el" href="struct_introduction_to_algorithm_1_1_set_algorithm_1_1_disjoint_set_node.html">DisjointSetNode</a>&lt; KType &gt; &gt;&#160;</td>
          <td class="paramname"><em>nodeY</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>link_set：链接集合 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">nodeX:待链接的第一个集合中的根节点。</td><td></td></tr>
    <tr><td class="paramname">nodeY:待合并的第二个集合中的根节点</td><td>每个结点x维持一个整数值属性rank,它代表了x的高度（从x到某一后代叶结点的最长简单路径上的结点数目）的一个上界。在链接时我们让具有较小秩的根指向具有较大秩的根.</td></tr>
  </table>
  </dd>
</dl>
<ul>
<li>如果 nodeX或者nodeY为空，则直接返回</li>
<li>如果 nodeX 和 nodeY非空，但是nodeX或者nodeY不是根结点，抛出异常 </li>
</ul>

<p>Definition at line <a class="el" href="disjointset_8h_source.html#l00124">124</a> of file <a class="el" href="disjointset_8h_source.html">disjointset.h</a>.</p>

</div>
</div>
<a class="anchor" id="a7346337c6f47bf066844c7101058cd92"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename KType &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static void <a class="el" href="struct_introduction_to_algorithm_1_1_set_algorithm_1_1_disjoint_set_node.html">IntroductionToAlgorithm::SetAlgorithm::DisjointSetNode</a>&lt; KType &gt;::make_set </td>
          <td>(</td>
          <td class="paramtype">std::shared_ptr&lt; <a class="el" href="struct_introduction_to_algorithm_1_1_set_algorithm_1_1_disjoint_set_node.html">DisjointSetNode</a>&lt; KType &gt; &gt;&#160;</td>
          <td class="paramname"><em>node</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>make_set：创建集合 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">node:创建集合的结点。它必须非空，否则抛出异常</td><td>该操作简单地创建一棵只有一个结点的树。它将树根的秩设为0，将树根的父节点指向树根本身 </td></tr>
  </table>
  </dd>
</dl>

<p>Definition at line <a class="el" href="disjointset_8h_source.html#l00100">100</a> of file <a class="el" href="disjointset_8h_source.html">disjointset.h</a>.</p>

</div>
</div>
<a class="anchor" id="aeb6281c8d6ec20987015fb1d1421b309"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename KType &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static void <a class="el" href="struct_introduction_to_algorithm_1_1_set_algorithm_1_1_disjoint_set_node.html">IntroductionToAlgorithm::SetAlgorithm::DisjointSetNode</a>&lt; KType &gt;::union_set </td>
          <td>(</td>
          <td class="paramtype">std::shared_ptr&lt; <a class="el" href="struct_introduction_to_algorithm_1_1_set_algorithm_1_1_disjoint_set_node.html">DisjointSetNode</a>&lt; KType &gt; &gt;&#160;</td>
          <td class="paramname"><em>nodeX</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">std::shared_ptr&lt; <a class="el" href="struct_introduction_to_algorithm_1_1_set_algorithm_1_1_disjoint_set_node.html">DisjointSetNode</a>&lt; KType &gt; &gt;&#160;</td>
          <td class="paramname"><em>nodeY</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>union_set：合并集合 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">nodeX:待合并的第一个集合中的某个结点</td><td></td></tr>
    <tr><td class="paramname">nodeY:待合并的第二个集合中的某个结点</td><td>该操作首先获取每个结点所在集合的代表结点，然后将它们合并起来 </td></tr>
  </table>
  </dd>
</dl>

<p>Definition at line <a class="el" href="disjointset_8h_source.html#l00151">151</a> of file <a class="el" href="disjointset_8h_source.html">disjointset.h</a>.</p>

</div>
</div>
<h2 class="groupheader">Member Data Documentation</h2>
<a class="anchor" id="ad5cf3f4d739ecd0c1f6d3b3005e21993"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename KType &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">std::shared_ptr&lt;<a class="el" href="struct_introduction_to_algorithm_1_1_set_algorithm_1_1_disjoint_set_node.html">DisjointSetNode</a>&gt; <a class="el" href="struct_introduction_to_algorithm_1_1_set_algorithm_1_1_disjoint_set_node.html">IntroductionToAlgorithm::SetAlgorithm::DisjointSetNode</a>&lt; KType &gt;::parent</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>结点的父指针 </p>

<p>Definition at line <a class="el" href="disjointset_8h_source.html#l00069">69</a> of file <a class="el" href="disjointset_8h_source.html">disjointset.h</a>.</p>

</div>
</div>
<a class="anchor" id="a1fd137f74ca1317bfb02d9e1640ce147"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename KType &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">int <a class="el" href="struct_introduction_to_algorithm_1_1_set_algorithm_1_1_disjoint_set_node.html">IntroductionToAlgorithm::SetAlgorithm::DisjointSetNode</a>&lt; KType &gt;::rank</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>结点的秩 </p>

<p>Definition at line <a class="el" href="disjointset_8h_source.html#l00068">68</a> of file <a class="el" href="disjointset_8h_source.html">disjointset.h</a>.</p>

</div>
</div>
<a class="anchor" id="ae01535aa5e8ba05dceedd5c475d61c18"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename KType &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">std::weak_ptr&lt;<a class="el" href="struct_introduction_to_algorithm_1_1_set_algorithm_1_1_disjoint_set_node.html#a8f801679de129d80a99ad683430c534a">KeyType</a>&gt; <a class="el" href="struct_introduction_to_algorithm_1_1_set_algorithm_1_1_disjoint_set_node.html">IntroductionToAlgorithm::SetAlgorithm::DisjointSetNode</a>&lt; KType &gt;::value</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>结点保存的数据的弱指针 </p>

<p>Definition at line <a class="el" href="disjointset_8h_source.html#l00067">67</a> of file <a class="el" href="disjointset_8h_source.html">disjointset.h</a>.</p>

</div>
</div>
<hr/>The documentation for this struct was generated from the following file:<ul>
<li>src/set_algorithms/disjoint_set/<a class="el" href="disjointset_8h_source.html">disjointset.h</a></li>
</ul>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="namespace_introduction_to_algorithm.html">IntroductionToAlgorithm</a></li><li class="navelem"><a class="el" href="namespace_introduction_to_algorithm_1_1_set_algorithm.html">SetAlgorithm</a></li><li class="navelem"><a class="el" href="struct_introduction_to_algorithm_1_1_set_algorithm_1_1_disjoint_set_node.html">DisjointSetNode</a></li>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.10 </li>
  </ul>
</div>
</body>
</html>
